package com.rfid.rfidbluetooth.manager;

import android.bluetooth.BluetoothDevice;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.base.base.BaseAdapter;
import com.rfid.rfidbluetooth.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BluetoothMAdapter extends BaseAdapter<BluetoothMAdapter.MyHolder, BluetoothDevice> {


    public BluetoothMAdapter(List data) {
        super(data);
    }

    @Override
    protected int getLayout() {
        return R.layout.item_bluetooth;
    }

    @Override
    protected MyHolder getViewHolder(View view) {
        return new MyHolder(view);
    }

    @Override
    protected void bindView(MyHolder holder, int position, BluetoothDevice device) {
        holder.name.setText("名称:" + device.getName());
        holder.mac.setText("MAC:" + device.getAddress());
    }


    public class MyHolder extends RecyclerView.ViewHolder{
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.mac)
        TextView mac;
        public MyHolder(@NonNull  View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
